﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ProjectSunny.Admin.Controls
{
    public partial class ListOrder : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!Page.IsPostBack)
            {
                //Them du lieu vao cat 1

                rpt_order.DataSource = DAL.DCollector.DBCollector.Instance.SelectTable("tbl_Orders");

                rpt_order.DataBind();

            }

        }

        protected void rpt_order_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "delete")
            {
                string id = (e.CommandArgument.ToString());

                DAL.DCollector.DBCollector.Instance.CallSQL1Param( "delete from tbl_Orders where Orders_ID='" + id+"'", false);

                rpt_order.DataSource = DAL.DCollector.DBCollector.Instance.StoredSelectTable("tbl_Orders");

                rpt_order.DataBind();
            }
        }
    }
}